package com.gutsyzhan.edoctor.tools;

import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Slf4j
@Component
public class TimeTools {
    @Tool(name = "时间",  value = "返回当前的时间")
    public String getCurrentTime(@ToolMemoryId int memoryId){
        // 创建格式化器
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 获取当前时间并格式化
        String currentTime = sdf.format(new Date());
        log.info("调用计算时间，memoryId:{},当前时间为:{}",memoryId,currentTime);
        return currentTime;
    }
}